package cn.yunhe.test;



import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.junit.Test;

import cn.yunhe.model.House;
import cn.yunhe.model.Street;
import cn.yunhe.model.Type;
import cn.yunhe.model.UserRegs;
import cn.yunhe.services.SerRent;

public class Demo {

	 SerRent serRent = new SerRent();
	 
	 @Test
	 public void test1() {
		 UserRegs userRegs=new UserRegs("许原军","123456","15093498965","许原军","user");
		 int falg =serRent.addUser(userRegs);
	  System.out.println(falg);
	 }

	 @Test
     public void test2() {
	   
		 UserRegs falg = serRent.login("許原軍", "123456");
	     System.out.println(falg);
	   
   }
	 @Test
	 public void test3() {
		Street street =serRent.selIdByStreet("西海淀区");
		System.out.println(street.getSid());
	 }
	 @Test
	 public void test4() {
		
		Type type =serRent.selIdByType("二室一厅");
		System.out.println(type.getTid());
	 }
	 
	@Test
	 public void test5() {
		   UserRegs userRegs = new UserRegs();
	       Street street =new Street();
	       Type type =new Type();
	       userRegs.setUid(2);
	       street.setId(1);
	       type.setId(1);
	      
	       
	       
	      
	       
		House house=new House(userRegs,type, "好像俩", "你最美", new BigDecimal(1233.02), new Date(), 200, "1503935", street,"kssds");
		int falg =serRent.addHouse(house);
		System.out.println(falg);
	 }
	 
	 
	 
	  
	  @Test
	  public void test7() {
		int falg=  serRent.getCount();
		  System.out.println(falg);
	  }
	  
	  @Test
	  public void test8() {
		  List<House> list= serRent.selectAll(2, 2);
			 for (House house : list) {
				System.out.println(house.getStreet_id().getDistrict_id().getDname());
			}
     }
	  
	  
	  
	  @Test
	   public void test9() {
		  
		   House house =new House();
		   house.setId(22);
		   UserRegs users = new UserRegs();
		   users.setUid(3);
		   house.setUser_id(users);
		   
		   int falg=serRent.delXinXi(house);
		   System.out.println(falg);
	  }
}

